﻿<controls:ChildWindow x:Class="Moria.Silverlight.Controls.NewGameDialog"
                      x:Name="dlgNewGame"
                      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
                      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
                      xmlns:moria="http://Moria/Silverlight"
                      xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
                      Width="550" Height="370" 
                      Title="New Character">
	<controls:ChildWindow.Resources>
		<moria:EnumConverter x:Key="EnumConverter" />
	</controls:ChildWindow.Resources>
	<Grid x:Name="LayoutRoot" Margin="2">
		<Grid.RowDefinitions>
			<RowDefinition Height="Auto" />
			<RowDefinition Height="Auto" />
			<RowDefinition Height="Auto" />
		</Grid.RowDefinitions>

		<TextBlock Style="{StaticResource Label}" Margin="3" VerticalAlignment="Center" HorizontalAlignment="Left" Text="Name:" />
		<TextBox Margin="45,3,3,3" Text="{Binding Mode=TwoWay, Path=name}" LostFocus="TextBox_LostFocus" TextChanged="TextBox_TextChanged" />

		<Grid Grid.Row="1">
			<Grid.ColumnDefinitions>
				<ColumnDefinition Width="95"/>
				<ColumnDefinition Width="95"/>
				<ColumnDefinition Width="95"/>
				<ColumnDefinition Width="95"/>
				<ColumnDefinition Width="*"/>
			</Grid.ColumnDefinitions>
			<Grid.RowDefinitions>
				<RowDefinition Height="Auto"/>
				<RowDefinition Height="Auto"/>
				<RowDefinition Height="Auto"/>
				<RowDefinition Height="Auto"/>
				<RowDefinition Height="Auto"/>
				<RowDefinition Height="Auto"/>
				<RowDefinition Height="Auto"/>
				<RowDefinition Height="Auto"/>
				<RowDefinition/>
			</Grid.RowDefinitions>

			<TextBlock Style="{StaticResource Label}" Text="Race:" />
			<ComboBox x:Name="cbRace" Grid.Column="1"  SelectionChanged="cbRace_SelectionChanged" >
				<ComboBox.ItemTemplate>
					<DataTemplate>
						<TextBlock Text="{Binding trace}"/>
					</DataTemplate>
				</ComboBox.ItemTemplate>
			</ComboBox>

			<TextBlock Grid.Row="1" Style="{StaticResource Label}" Text="Class:" />
			<ComboBox x:Name="cbClass" Grid.Row="1" Grid.Column="1" SelectionChanged="cbClass_SelectionChanged" >
				<ComboBox.ItemTemplate>
					<DataTemplate>
						<TextBlock Text="{Binding title}"/>
					</DataTemplate>
				</ComboBox.ItemTemplate>
			</ComboBox>

			<TextBlock Grid.Row="2" Style="{StaticResource Label}" Text="Gender:" />
			<ComboBox x:Name="cbGender" Grid.Row="2" Grid.Column="1" SelectionChanged="cbGender_SelectionChanged" >
				<ComboBox.ItemTemplate>
					<DataTemplate>
						<TextBlock Text="{Binding Converter={StaticResource EnumConverter}}"/>
					</DataTemplate>
				</ComboBox.ItemTemplate>
			</ComboBox>

			<TextBlock Grid.Row="0" Grid.Column="2" Style="{StaticResource Label}" Text="Age:" />
			<TextBlock Grid.Column="3" HorizontalAlignment="Left" Style="{StaticResource Label}" Text="{Binding age}" Margin="3,3,0,3" />

			<TextBlock Grid.Row="1" Grid.Column="2" Style="{StaticResource Label}" Text="Height:" />
			<TextBlock Grid.Row="1" Grid.Column="3" HorizontalAlignment="Left" Style="{StaticResource Label}" Text="{Binding ht}" Margin="3,3,0,3" />

			<TextBlock Grid.Row="2" Grid.Column="2" Style="{StaticResource Label}" Text="Weight:" />
			<TextBlock Grid.Row="2" Grid.Column="3" HorizontalAlignment="Left" Style="{StaticResource Label}" Text="{Binding wt}" Margin="3,3,0,3" />

			<TextBlock Grid.Row="3" Grid.Column="2" Style="{StaticResource Label}" Text="Social Class:" />
			<TextBlock Grid.Row="3" Grid.Column="3" HorizontalAlignment="Left" Style="{StaticResource Label}" Text="{Binding ElementName=dlgNewGame, Path=SocialClass}" Margin="3,3,0,3" />

			<TextBlock Grid.Row="4" Grid.Column="0" Style="{StaticResource Label}" Text="+ To Hit:" />
			<TextBlock Grid.Row="4" Grid.Column="1" HorizontalAlignment="Left" TextAlignment="Right" Width="20"  Style="{StaticResource Label}" Text="{Binding ElementName=dlgNewGame, Path=ToHit}" Margin="3,3,0,3"/>

			<TextBlock Grid.Row="5" Grid.Column="0" Style="{StaticResource Label}" Text="+ To Damage:" />
			<TextBlock Grid.Row="5" Grid.Column="1" HorizontalAlignment="Left" TextAlignment="Right" Width="20" Style="{StaticResource Label}" Text="{Binding ElementName=dlgNewGame, Path=ToDmg}" />

			<TextBlock Grid.Row="6" Grid.Column="0" Style="{StaticResource Label}" Text="+ To AC:" />
			<TextBlock Grid.Row="6" Grid.Column="1" HorizontalAlignment="Left" TextAlignment="Right" Width="20" Style="{StaticResource Label}" Text="{Binding ElementName=dlgNewGame, Path=ToAC}" />

			<TextBlock Grid.Row="7" Grid.Column="0" Style="{StaticResource Label}" Text="Total AC:" />
			<TextBlock Grid.Row="7" Grid.Column="1" HorizontalAlignment="Left" TextAlignment="Right" Width="20" Style="{StaticResource Label}" Text="{Binding ElementName=dlgNewGame, Path=TotalAC}" />

			<Border Grid.Row="8" Grid.ColumnSpan="5" BorderBrush="Black" BorderThickness="2" CornerRadius="5,0,5,5" 
                    Margin="0" 
                    HorizontalAlignment="Center" VerticalAlignment="Top" Width="455" Height="80">
				<Grid HorizontalAlignment="Stretch">

					<TextBlock Style="{StaticResource Label}" Margin="0,0,0,0"  HorizontalAlignment="Center" VerticalAlignment="Top" Text="Character Background" />

					<TextBlock Grid.Row="8" Grid.Column="0"  Grid.ColumnSpan="5" HorizontalAlignment="Center" 
                       Style="{StaticResource Label}" Text="{Binding ElementName=dlgNewGame, Path=History}" 
                              TextWrapping="Wrap" VerticalAlignment="Bottom" />
				</Grid>
			</Border>

			<Border Grid.Column="4"  Grid.RowSpan="8" BorderBrush="Black" BorderThickness="2" CornerRadius="5,0,5,5" Margin="3,0,0,10">
				<Grid>
					<Grid.ColumnDefinitions>
						<ColumnDefinition Width="Auto"/>
						<ColumnDefinition Width="*"/>
					</Grid.ColumnDefinitions>
					<Grid.RowDefinitions>
						<RowDefinition/>
						<RowDefinition/>
						<RowDefinition/>
						<RowDefinition/>
						<RowDefinition/>
						<RowDefinition/>
					</Grid.RowDefinitions>

					<TextBlock Grid.Row="0" Grid.Column="0" Style="{StaticResource Label}" Text="Strength" VerticalAlignment="Center" HorizontalAlignment="Center"/>
					<TextBlock Grid.Row="0" Grid.Column="1" Style="{StaticResource Label}" Text="{Binding ElementName=dlgNewGame, Path=Str}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
					<TextBlock Grid.Row="1" Grid.Column="0" Style="{StaticResource Label}" Text="Intelligence" VerticalAlignment="Center" HorizontalAlignment="Center"/>
					<TextBlock Grid.Row="1" Grid.Column="1" Style="{StaticResource Label}" Text="{Binding ElementName=dlgNewGame, Path=Int}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
					<TextBlock Grid.Row="2" Grid.Column="0" Style="{StaticResource Label}" Text="Wisdom" VerticalAlignment="Center" HorizontalAlignment="Center"/>
					<TextBlock Grid.Row="2" Grid.Column="1" Style="{StaticResource Label}" Text="{Binding ElementName=dlgNewGame, Path=Wis}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
					<TextBlock Grid.Row="3" Grid.Column="0" Style="{StaticResource Label}" Text="Dexterity" VerticalAlignment="Center" HorizontalAlignment="Center"/>
					<TextBlock Grid.Row="3" Grid.Column="1" Style="{StaticResource Label}" Text="{Binding ElementName=dlgNewGame, Path=Dex}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
					<TextBlock Grid.Row="4" Grid.Column="0" Style="{StaticResource Label}" Text="Constitution" VerticalAlignment="Center" HorizontalAlignment="Center"/>
					<TextBlock Grid.Row="4" Grid.Column="1" Style="{StaticResource Label}" Text="{Binding ElementName=dlgNewGame, Path=Con}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
					<TextBlock Grid.Row="5" Grid.Column="0" Style="{StaticResource Label}" Text="Charisma" VerticalAlignment="Center" HorizontalAlignment="Center"/>
					<TextBlock Grid.Row="5" Grid.Column="1" Style="{StaticResource Label}" Text="{Binding ElementName=dlgNewGame, Path=Chr}" VerticalAlignment="Center" HorizontalAlignment="Center"/>

				</Grid>
			</Border>

		</Grid>
		<StackPanel Grid.Row="2" Margin="3,10" HorizontalAlignment="Right" Orientation="Horizontal">
			<Button x:Name="OKButton" Width="140" Height="23" HorizontalAlignment="Right" Margin="5" Style="{StaticResource ButtonStyle1}">
				<Grid Width="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Center">
					<Grid.ColumnDefinitions>
						<ColumnDefinition Width="*"/>
						<ColumnDefinition Width="20"/>
					</Grid.ColumnDefinitions>
					<TextBlock Text="OK" HorizontalAlignment="Left" Margin="3,0"/>
					<Image Grid.Column="1" Source="/Moria.Silverlight;component/Assets/Images/green%20check.png" HorizontalAlignment="Right"   Margin="3,0"/>
				</Grid>
			</Button>
			<Button x:Name="CancelButton"  Click="RerollButton_Click" Width="140" Height="23"                 HorizontalAlignment="Right" Margin="5" >
				<Grid Width="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Center">
					<Grid.ColumnDefinitions>
						<ColumnDefinition Width="*"/>
						<ColumnDefinition Width="20"/>
					</Grid.ColumnDefinitions>
					<TextBlock Text="Re-roll" HorizontalAlignment="Left" Margin="3,0"/>
					<Image Grid.Column="1" Source="/Moria.Silverlight;component/Assets/Images/dice.png" HorizontalAlignment="Right"   Margin="3,0"/>
				</Grid>
			</Button>
		</StackPanel>
	</Grid>
</controls:ChildWindow>